package com.lancoo.examview.svga.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.EditText;

/**
 * Created by pengmi on 2022/5/7 10:55
 * Description:
 */
public class MyEditText extends EditText {

    private String str="";

    public MyEditText(Context context){

        super(context);

    }

    public MyEditText(Context context, AttributeSet attrs) {

        super(context, attrs);

    }

    public MyEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {

        super(context, attrs, defStyleAttr, defStyleRes);

    }

    public MyEditText(Context context, AttributeSet attrs, int defStyle) {

        super(context, attrs, defStyle);

    }

    public void setStr(String str){

        this.str = str;

    }

    @Override

    protected void onDraw(Canvas canvas) {

        super.onDraw(canvas);

        Paint paint = new Paint();

        paint.setAntiAlias(true);

        //编写提示文字。
        canvas.drawText(str,500,getHeight()/2+5,paint);

        super.onDraw(canvas);

    }

}
